Skip to main content

Render pages

Alosaur can support any html renderer. All you need to do is customize and implement the template renderer.

example

In the example applications you can find: Dejs, Handlebars, Angular, React, Eta https://github.com/alosaur/alosaur/tree/master/examples/

An example of a Handlebars setup:

// Handlebars...// Basedir pathconst viewPath = `${Deno.cwd()}/examples/handlebars/views`;
// Create Handlebars renderconst handle = new Handlebars();
app.useViewRender({    type: 'handlebars',    basePath: viewPath,    getBody: async (path: string, model: any, config: ViewRenderConfig) => await handle.renderView(path, model),});
...

Handlebars support custom config, more about handlebars for deno: https://github.com/alosaur/handlebars

new Handlebars(  {    baseDir: viewPath,    extname: ".hbs",    layoutsDir: "layouts/",    partialsDir: "partials/",    defaultLayout: "main",    helpers: undefined,    compilerOptions: undefined,  },);